<script lang="ts" setup>
/*
  学习目标：ref的ts配合写法
 
*/
import { ref } from 'vue';
import MyChild from './components/MyChild.vue';


interface TodoItem {
  id: number;
  name: string;
}

//  1. 基本数据类型, 省略泛型写法
const money = ref(100);

// 2. 复杂数据类型, 完整泛型函数写法
const list = ref<TodoItem[]>([])

setTimeout(() => {
  list.value = [{ id: 1, name: "zs" }]
}, 2000)


const fn = (num: number) => {
  money.value -= num
}

</script>

<template>
  <MyChild :money="money" @change-money="fn" />
</template>

<style lang="scss" scoped>

</style>